home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / arts / cachedwav.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-09-10  |  2.2 KB  |  82 lines

  1.     /*
  2.  
  3.     Copyright (C) 2000 Stefan Westerfeld
  4.                        stefan@space.twc.de
  5.  
  6.     This library is free software; you can redistribute it and/or
  7.     modify it under the terms of the GNU Library General Public
  8.     License as published by the Free Software Foundation; either
  9.     version 2 of the License, or (at your option) any later version.
  10.  
  11.     This library is distributed in the hope that it will be useful,
  12.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  14.     Library General Public License for more details.
  15.  
  16.     You should have received a copy of the GNU Library General Public License
  17.     along with this library; see the file COPYING.LIB.  If not, write to
  18.     the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  19.     Boston, MA 02111-1307, USA.
  20.  
  21.     */
  22.  
  23. #ifndef CACHEDWAV_H
  24. #define CACHEDWAV_H
  25.  
  26. #include "config.h"
  27. #include "arts_export.h"
  28. #ifdef HAVE_LIBAUDIOFILE
  29. #include "cache.h"
  30. #include <sys/stat.h>
  31. #include <unistd.h>
  32.  
  33. /*
  34.  * BC - Status (2002-03-08): CachedWav.
  35.  *
  36.  * At the current point in time, there are NO GUARANTEES, so only use this
  37.  * in apps part of official KDE releases (such as kdemultimedia apps), which
  38.  * know what is happening here. Especially, in SOME kde versions this class
  39.  * might not even exist, as it gets conditionally compiled.
  40.  */
  41.  
  42. namespace Arts {
  43.  
  44. class ARTS_EXPORT CachedWav : public CachedObject
  45. {
  46. protected:
  47.     struct stat oldstat;
  48.     std::string filename;
  49.     bool initOk;
  50.  
  51.     CachedWav(Cache *cache, std::string filename);
  52.     ~CachedWav();
  53.  
  54.     typedef unsigned char uchar;
  55. public:
  56.     double samplingRate;
  57.     long bufferSize;
  58.     int channelCount;
  59.     int sampleWidth;
  60.     unsigned char *buffer;
  61.  
  62.     static CachedWav *load(Cache *cache, std::string filename);
  63.     /**
  64.      * validity test for the cache - returns false if the object is having
  65.      * reflecting the correct contents anymore (e.g. if the file on the
  66.      * disk has changed), and there is no point in keeping it in the cache any
  67.      * longer
  68.      */
  69.     bool isValid();
  70.     /**
  71.      * memory usage for the cache
  72.      */
  73.     int memoryUsage();
  74.     
  75.     std::string mediaName() const { return filename; }
  76. };
  77.  
  78. }
  79.  
  80. #endif /* HAVE_LIBAUDIOFILE */
  81. #endif /* CACHEDWAV_H */
  82.